home *** CD-ROM | disk | FTP | other *** search
- SFLI FLI playing routine v1.0
- (c) 1996 SHAi'TAN
-
- Index
-
- 1.0 Introduction
- 1.1 Disclaimer
- 1.2 Other interesting things
-
- 2.0 Basic usage
-
- 3.0 The FLI File
- 3.1 Header
- 3.2 Frames
- 3.3 Chunks
-
- 4.0 The Chunks
- 4.1 Palette
- 4.2 Copy
- 4.3 Black
- 4.4 Byte-wise runlength
- 4.5 Line-compression
-
- 5.0 Techniques used(not many...)
- 5.1 Timer
- 5.2 Buffers
-
- 6.0 Everything else
- 6.1 Contacting me
- ────────────────────────────────────────────────────────────────────────────────
-
-
- 1.0 Introduction
-
- As you might have figured out this is a routine for playing FLI files. As I
- hate writing dox i'll keep'em short...and since i'm not from England
- (fortunately...=)...) all linguistic errors are excused. The only thing
- (apart from the amazing fades) that differs this viewer from all the others
- is that you have all the source code(100% unreadable asm...)...
- To compile the code you need Turbo Assembler...version 3.1 works just fine...
-
- 1.1 Disclaimer
-
- I exclude any and all warranties, including warranties of merchantability and
- fitness for use of this code. This includes, but does not limit to, any
- damages to the equipment(and the person using it, including your wife,
- children, dog and/or sister/borther...=).
- Further, this code is for PRIVATE use only. For commercial use please contact
- me. This code is also FREE, which means that you may not sell it for profit.
- Neither may it be distributed within another package, that is not FREE.
- If this code is altered or used in another package, I must be credited for it.
-
- For those of you that don't understand:
-
- If you fuck up, it's your problem, not mine. If you try to sell this code,
- or use it in your totally amazing commercial or shareware game, you're
- breaking the law. If you modify or use the code in one or your free packages,
- put my name somewhere where everybody can see it.
- And remember: stealing code is LAME...
-
- 1.2 Other interesting things
-
- If you find any use for the code, please drop me an e-mail. If you find it
- completely useless, send the e-mail anyway. And since we're at it, if you
- ever do something in ASM/C/C++, send me a copy of it...it's us REAL
- coders against microsoft...so why don't we help eachother...=)
- ────────────────────────────────────────────────────────────────────────────────
-
- 2.0 Basic Usage (This part is in case of future updates...)
-
- Uhm...haven't ye figured it out yet?
- ────────────────────────────────────────────────────────────────────────────────
-
- 3.0 The FLI File
-
- The FLI File begins with a header. Then come the frames, which are divided
- into chunks. Each frame and chunk have a header. Almost all data is compressed,
- which improves viewing speed, while making the animation smaller(good if
- you only have 1Gb of HD space...)
-
- 3.1 Header
-
- The header contains info about the FLI(Things like size,num_of_frames and so
- on). It is 128 bytes long.
-
- The Header:
-
- Size Name Description
-
- DWORD size Total size of the FLI file(Header included)...good if ye
- wanna pre-load it into memory.
- WORD magic ALWAYS 0AF11h for 320*200*256 standard FLI files.
- WORD frames Number of frames in FLI, max 4000.
- WORD width FLI width (320).
- WORD height FLI height (200).
- WORD depth Number of bits/pixel (8).
- WORD flags Should be 0.
- WORD speed Number of video ticks(approx 70th's of a second) between
- frames.
- DWORD next Dunno...should be 0.
- DWORD frit Dunno...should be 0.
- 102 BYTE expand Future expansion space.
-
- 3.2 Frames
-
- The frame is divided into chunks, each chunk containing different data. The
- frame is divided into a 16-byte header and the the chunks themselves.
-
- The Frame:
-
- DWORD size Total size of this frame(Frame header included). Should be
- less than 64K(to fit in one SEG) for normal FLI files.
- WORD magic ALWAYS 0F1FA.
- WORD chunks Number of chunks in this frames.
- 8 BYTE expand Future expansion space.
- ? data Frame data.
-
- 3.3 Chunks
-
- The chunks are the data itself. Each chunk has a 6-byte header. There are
- five types of chunks, as described below.
-
- The Chunk:
-
- DWORD size The size of this chunk(chunk header included).
- WORD type The chunk type(see part 4).
- ? data Chunk data.
- ────────────────────────────────────────────────────────────────────────────────
-
- 4.0 The Chunks
-
- There are 5 types of chunks, each having a different function...check the
- source to find out more about them...(this is getting boring....)
-
- 4.1 Palette
-
- FLI_COLOR
- Compressed palette chunk...check the source...
- [section incomplete]
-
- 4.2 Copy
-
- FLI_COPY
- 64000 bytes of uncompressed data to be copied to the screen. Very easy.
-
- 4.3 Black
-
- FLI_BLACK
- No data in this one...simply clear the video mem...
-
- 4.4 Bytewise Run-length
-
- FLI_BRUN
- Compressed data...check the source...
- [section incomplete]
-
- 4.5 Line-Comperssion
-
- FLI_LC
- Compressed data. Similar to FLI_BRUN...check the source...
- [section incomplete]
- ────────────────────────────────────────────────────────────────────────────────
-
- 5.0 Techiniques
-
- In this routine, i use some fairly simple techs, like buffering and interrupts.
- Thanx to Dreaden / VLA for his nice ASM TSR tute...
- Remember that the code needs a 386 to run...this is not because i use protected
- mode or something like that, but i use the FS and GS segment registers, one
- for each buffer...
-
- 5.1 Timer
-
- I needed something to generate an interrupt 70 times/sec(for correct video
- timing). Easiest way is to use the INT 1Ah interrupt. The only problem
- is that that interrupt is generated approx 18.2 times/second. Fortunately,
- the rate can be changed by messing with the 8253 PIT hardware(see PCGPE for
- info about that one...). What i want is to make it tick 70 times/second.
- Writing the magic bytes to the right port accomplishes that, but leaves
- one nasty problem...the INT 1Ah is called by the INT 08 routine...which
- also handles the clock. So if we increase the ticking, the clock will go
- crazy. Solution: We use the INT 08 interrupt instead, and update the clock
- only when needed. So...we setup the PIT to tick(generate INT 08) 70 times/
- second...but unfortunately, 70 isn't dividable by 18(normal speed...remeber?)
- and since we can't use floats(way too slow...), we increase the tick speed
- to the least common multiple of 70 and 18(630), and utdate the clock every
- 35:th tick and the video timer counter every 9:th tick...simple!
-
- 5.2 Buffers
-
- In this program, i used two buffers. One for a copy of the video memory, so
- all can be prepared during timing and then simply copied onto the screen.
- The second one was a data buffer, where the chunk data was loaded, before
- decompessing. The time gained by this is the time for the HD to seek each
- byte as it is needed.
- ────────────────────────────────────────────────────────────────────────────────
-
- 6.0 Everything else
-
- As you may have noticed, the chunk descs were incomplete...i might
- update the dox later on...and the fli player too...
- If you want more info about the FLI file, check out PCGPE found at
- x2ftp.oulu.fi. There are tonnes of useful programming info there.
- Also check the Hornet Archive at ftp.luth.se/pub/msdos/demo (mirror of
- ftp.cdrom.com) for info on gfx/sound programming and demos.
-
- 6.1 Contacting me
-
- If ye wanna contact me for some reason, the easiest way is to e-mail me at
- shaitan@proxxi.uf.se. It's always nice to get to know other coders out there,
- so if you have made something, send me a copy of the source. If you wanna
- finance a pizza/coke for me, don't unless it's more than 10$...i'm sure you
- can spend the money better than me...note; this applies only to private users.
- If you wanna use the code for commercial purposes(like shop-windows or games)
- you must register the program. Send me an e-mail to get a registration form.
-
- -=SHAi'TAN '96=-
-
-
-